import Vue from 'vue'
import Vuex from 'vuex'
import userModule from './modules/user.js'
import createPersistedState from "vuex-persistedstate";

Vue.use(Vuex)

export default new Vuex.Store({
	modules:{
		userModule
	},
	plugins:[createPersistedState({
      storage: {
        getItem: (key) => uni.getStorageSync(key),
        // Please see https://github.com/js-cookie/js-cookie#json, on how to handle JSON.
        setItem: (key, value) =>
          uni.setStorageSync(key,value),
        removeItem: (key) => uni.removeStorageSync(key),
      },
    })]
})